package com.wennimei.domain;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class SinaNews {

    private String id;

    private String title;

    private String link;

    private String type;

    private String description;

    private Date pubDate;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getPubDate() {
        return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(pubDate);
    }

    public void setPubDate(String pubDate) {
        try {
            this.pubDate = new SimpleDateFormat("E, dd MMM yyyy hh:mm:ss z",
                    Locale.US).parse(pubDate);
        } catch (ParseException e) {
            this.pubDate = new Date();
        }
    }

}
